import router from "@/router"
import useTokenStore from "@/stores/token"

router.beforeEach((to, from, next) => {
  const { token } = useTokenStore()
  if (to.path === "/" && !token) {
    next("/login")
  } else {
    next()
  }
})
